﻿namespace SourceCodeRepository.Model.Validation.Tests
{
    using System.Linq;
    using Infra.Validation;
    using ValidationRules.CodeSnippetRules;
    using Xunit;

    internal class TestEntity
    {
        public string Name { get; set; }
        public int Age { get; set; }
        public bool IsMale { get; set; }
    }
    
    public class ModelValidationFacts
    {
        [Fact]
        public void Tests_ContributorInSnippetEmptyValidationRule_Rule()
        {
            var entity = new CodeSnippet();
            entity.Language = new Language();
            entity.SnippetText = "Test";
            
            var validationResult = ValidationEasier.ValidateRule(new ContributorInSnippetEmptyValidationRule(), entity);
            Assert.Equal(1, validationResult.NumberOfErrors);
            Assert.Equal("The contributor cannot be empty.", validationResult.Messages.First().Message);
        }
    }
}
